import torch

print(dir(torch.distributions))

# 检查CUDA是否可用
cuda_available = torch.cuda.is_available()
print(f"CUDA available: {cuda_available}")
    
if cuda_available:
    # 获取CUDA版本
    print(f"CUDA version: {torch.version.cuda}")
        
    # 获取当前设备
    current_device = torch.cuda.current_device()
    print(f"Current device: {current_device}")
        
    # 获取设备名称
    device_name = torch.cuda.get_device_name(current_device)
    print(f"Device name: {device_name}")
        
    # 获取设备数量
    device_count = torch.cuda.device_count()
    print(f"Device count: {device_count}")
        
    # 显示所有可用设备
    print("\nAvailable devices:")
    for i in range(device_count):
        print(f"Device {i}: {torch.cuda.get_device_name(i)}")
else:
    print("PyTorch is not compiled with CUDA support or no GPU is available")

tensor = torch.rand(3,4,device='cuda')

print(f"Shape of tensor: {tensor.shape}")
print(f"Datatype of tensor: {tensor.dtype}")
print(f"Device tensor is stored on: {tensor.device}")